vt-d: Fix ioapic_rte_to_remap_entry error path.
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 9 Aug 2010 15:33:45 +0000 (16:33 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 9 Aug 2010 15:33:45 +0000 (16:33 +0100)
When ioapic_rte_to_remap_entry fails, currently it just writes value
to ioapic. But the 'mask' bit may be changed if it writes to the upper
half of RTE. This patch ensures to recover the original value of 'mask'
bit in this case.

Signed-off-by: Weidong Han <weidong.han@intel.com>
xen/drivers/passthrough/vtd/intremap.c

index 1f9ca0e54c5ecce041626f5c597a7408a9633e36..78587b2c6ed15a908df4be366364facbdd4c9e5c 100644 (file)
@@ -440,6 +440,13 @@ void io_apic_write_remap_rte(
     {
         *IO_APIC_BASE(apic) = rte_upper ? (reg + 1) : reg;
         *(IO_APIC_BASE(apic)+4) = value;
+
+        /* Recover the original value of 'mask' bit */
+        if ( rte_upper )
+        {
+            *IO_APIC_BASE(apic) = reg;
+            *(IO_APIC_BASE(apic)+4) = *(((u32 *)&old_rte)+0);
+        }
         return;
     }